<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="__JS__/mui.min.js"></script>
    <link href="__CSS__/mui.min.css" rel="stylesheet"/>
    <link href="__CSS__/base.css" rel="stylesheet" />
    <link href="__CSS__/login.css" rel="stylesheet" />
</head>
<body>
	<div class="mui-off-canvas-wrap mui-draggable mui-slide-in">
		<header class="app_header">登录</header>
		
		<!--主要内容-->
		<section class="login_box mui-inner-wrap">
			<!--title-->
			<div class="title_box">
				<div class="title">齐悦合作商绑定账号</div>
			</div>
			<div class="entry_box">
				<!--list-->
				<div class="entry_list phone_entry">
					<div class="name">手机号</div>
					<input type="number" id="phone" placeholder="请输入手机号"/>
				</div>
				<div class="entry_list phone_entry">
					<div class="name">密码</div>
					<input type="password" id="password" placeholder="请输入密码"/>
				</div>
				<!--list-->
				<div class="entry_list">
					<input type="number" id="checkcode" placeholder="输入验证码"/>
					<div class="verification_box">
						<div class="send_button" id="send_button">发送验证码</div>
					</div>
				</div>
			</div>
			<!--login-->
			<div class="login_button" id="login_button">确认</div>
		</section>
	</div>
</body>
<script type="text/javascript" src="__JS__/filexible_css.js" ></script>
<script type="text/javascript" src="__JS__/flexible.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-2.0.3.min.js"></script>
<script>
	mui.init();
	
	/* $(".login_button").click(function(){
		var phone=$("#phone").val();
		var checkcode=$("#checkcode").val();
		var password=$("#password").val();
		if(phone==""){
			mui.alert("请输入手机号码");return false;
		}
		if(password==""){
			mui.alert("请输入密码");return false;
		}
		if(checkcode==""){
			mui.alert("请输入验证码");return false;
		}
		$.post("{:U('PartnerLogin')}",{phone:phone,checkcode:checkcode,password:password},function(json){
			var data=eval(json);
			mui.toast(data.info);
			if(data.status==1){
				window.location.href=data.url;
			}
			//发送验证码的按钮变成数字
		});
	}); */
	
	/*发送验证码*/
	mui('body').on('tap','.send_button',function(){
		var phone=mui("#phone")[0].value;
	
		mui.get("{:U('sendCheckCode')}",{phone:phone},function(json){
			data=eval(json);
			mui.alert(data.info); 
			
			if(data.status==1){
				//修改按钮
				mui("#send_button")[0].classList.remove("send_button");
				mui("#send_button")[0].classList.add("send_button_out");
				timeshow();
			}
		});
	});
	/*按钮计时器*/
	function timeshow(){
    		var time = 60;//s
    		var start = window.setInterval(function(){
        	time = time - 1;
        	console.log(time);
        	mui("#send_button")[0].classList.add("mui-disabled");
        	mui("#send_button")[0].innerHTML=time;
        	if(time == 0){
            window.clearInterval(start);
            mui("#send_button")[0].classList.remove("send_button_out");
            mui("#send_button")[0].classList.remove("mui-disabled");
            mui("#send_button")[0].classList.add("send_button");
            mui("#send_button")[0].innerHTML="发送验证码";
        	}
    	},1000);
	}
	
	mui("body").on("tap","#login_button",function(){
		var phone=mui("#phone")[0].value;
		var checkcode=mui("#checkcode")[0].value;
		var password=mui("#password")[0].value;
		if(phone==""){
			mui.alert("请输入手机号码");return false;
		}
		if(password==""){
			mui.alert("请输入密码");return false;
		}
		if(checkcode==""){
			mui.alert("请输入验证码");return false;
		}
		mui.post("{:U('PartnerLogin')}",{phone:phone,checkcode:checkcode,password:password},function(json){
			data=eval(json);
			mui.toast(data.info); 
			
			if(data.status==1){
				window.location.href=data.url;
			}
		});
		
	});
	
</script>
</html>